package com.cy.personer.biz.impl;

import com.cy.personer.bean.Combo;
import com.cy.personer.bean.Role;
import com.cy.personer.biz.RoleBiz;
import com.cy.personer.mapper.RoleMapper;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
@Service
public class RoleBizImpl implements RoleBiz {
    @Resource
    private RoleMapper roleMapper;
    @Override
    public List<Role> query() {
        return roleMapper.query();
    }

    @Override
    public boolean add(Role role) {
        return false;
    }

    @Override
    public boolean update(int roleId) {
        return false;
    }
    @Override
    public boolean del(int roleId) {
        try {
            boolean state = roleMapper.del(roleId);
            return state;
        }
        catch (Exception e){
            return false;
        }
    }


    @Override
    public PageInfo<Role> getRoles( Integer pageNum) {
       PageHelper.startPage(pageNum,5);
        List<Role> quer = roleMapper.quer();
        PageInfo<Role> PageInfo = new PageInfo<>(quer);
        return PageInfo;
//        Page<Role> page =PageHelper.startPage(pageNum,5);
//        roleMapper.quer();
//        PageInfo<Role> PageInfo = new PageInfo<>(page);
//        return PageInfo;
    }





}
